home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / quote2.arc / QU_INDX.C next >
Encoding:
C/C++ Source or Header  |  1986-09-20  |  564 b   |  31 lines

  1. #include <stdio.h>
  2. main()
  3. {
  4. char name[60],outname[60];
  5. long count,start;
  6. int ch,lcount;
  7. FILE *infile,*outfile;
  8.  
  9. strcpy(name,"quote.dat");
  10. strcpy(outname,"quote.idx");
  11. infile = fopen(name,"rb");
  12. outfile = fopen(outname,"w");
  13.  
  14. count = 0;
  15. lcount = 0;
  16. while((ch = fgetc(infile)) != EOF) {
  17.   count++;
  18.   if (ch == '{') {
  19.     lcount++;
  20.     start = count;
  21.     do  count++; while ((ch = fgetc(infile)) != (int) '}');
  22.     fprintf(outfile,"%10ld %10ld\n",start,count);
  23.   }
  24. }
  25. fprintf(outfile,"%10d",lcount);
  26. fclose(infile);
  27. fclose(outfile);
  28. }
  29.  
  30.  
  31.